<?php
	
	/**
	 * @see Zend_Db_Table_Abstract
	 */
	require_once 'Zend/Db/Table/Abstract.php';
	
	
	abstract class Bike_Db_Table_Abstract extends Zend_Db_Table_Abstract
	{		const PK_DELIM = ',';
		const BASE_LANGUAGE = 'en';

		static protected $_baseLanguage;

		protected $_rowClass = 'Bike_Db_Table_Row';
		protected $_rowsetClass = 'Bike_Db_Table_Rowset';

		static public function setBaseLanguage($Language)
		{			self::$_baseLanguage = $Language;
		}

		static public function getBaseLanguage()
		{			return (self::$_baseLanguage) ? self::$_baseLanguage : self::BASE_LANGUAGE;
		}

		protected function _setupTableName()
		{
			if(!$this->_name)
			{				throw new Zend_Db_Table_Exception("No database table name");
			}
			$config = $this->getAdapter()->getConfig();
			$this->_name = $config['tablePrefix'].$this->_name;
			parent::_setupTableName();
		}

		protected function _setupPrimaryKey()
		{
			if(sizeof($this->_primary) == 1)
			{
				$this->_primary = explode(self::PK_DELIM, reset($this->_primary));
			}
			parent::_setupPrimaryKey();
		}

		public function getName()
		{			return $this->info(self::NAME);
		}

		public function getPrimary()
		{			return $this->_primary;
		}
		
		public function getMetadata()
		{
			return $this->info(self::METADATA);
		}
		
		public function getColumns()
		{
			return $this->info(self::COLS);
		}

	}